package com.lcredu.lcrliving.commodity.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @author kirito
 * @create 2023-10-08 11:10
 */
@Configuration
@EnableTransactionManagement //开启事务
@MapperScan("com.lcredu.lcrliving.commodity.dao")
public class MybatisConfig {
    //引入分页插件
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();

        //做基本的设置
        //溢出时设置第一页
        paginationInterceptor.setOverflow(true);
        //单页设置100条,0/-1表示不限制
        paginationInterceptor.setLimit(100);

        return paginationInterceptor;
    }
}
